package extend;

/**
 * Created by sunyuming on 19/8/28.
 */
public class ExtendMain {
    public static void main(String [] f) {

        Father father = new Sun();
        System.out.println(father.a);// 1
        System.out.println(father.getA()); // 2
    }

    public static class Father {
        public int a = 1;

        public int getA() {
            return a;
        }
    }

    public static class Sun extends Father {
        public int a = 2;

        public int getA() {
            return a;
        }
    }
}
